package com.bafa.util.comparators;

import java.util.Comparator;

import com.bafa.objects.Match;
import com.bafa.objects.Score;

public class ScoreByMostScoredComparator implements Comparator {

	public int compare(Object arg0, Object arg1) {
		Score match1 = (Score)arg0;
		Score match2 = (Score)arg1;
		
		
		if(match1.getGoalsFor()==match2.getGoalsFor()){
			if(match1.getDate().compareTo(match2.getDate())!=0)
				return match1.getDate().compareTo(match2.getDate());
			else
				return -1;
		}
		
		return match2.getGoalsFor() - match1.getGoalsFor();
	}

}
